package health.lm.com.data;

import android.content.Context;

import com.blankj.utilcode.util.StringUtils;

/**
 * @author Administrator 登录用户信息
 */
public class AppModel {

    public static String my_business_id;//我的商会ID
    public static String my_activity_id;//我的活动ID
    public static String phone;//手机号
    private static BaseSharedPreference sp;
    private String access_token;// token
    private String uid;// id
    private long apkid;
    private String city;
    private String city_id;
    private String local;
    private String coin_name;//代币名称（如：商基因）
    private String coin_url;//代币url
    private String sugar_name;//糖果名称 （如：糖果）
    private String sugar_url;//糖果url
    private String boot_img;//启动页url
    private String boot_link;//启动页跳转链接
    private String nick_name;//用户昵称
    private String system_title;//平台名称
    private String first_level_team;//平台一级团队名称
    private String second_level_team;//平台二级团队名称
    private String agreement_url;//平台协议地址
    private String target_num;//计步规定步数
    private String menu_1;//底部按钮首页
    private String menu_2;//底部按钮资讯
    private String menu_3;//底部按钮智库
    private String menu_4;//底部按钮体验店
    private String menu_5;//底部按钮我的
    private String loading_title;//下拉刷新显示文字
    private String circle_url;//圈子规则

    public static AppModel init(Context ctx) {
        AppModel model = new AppModel();
        sp = BaseSharedPreference.init();
        model.access_token = sp.getAccessToken();
        model.uid = sp.getUID();
        model.apkid = sp.getAPKID();
        model.city = sp.getCITY();
        model.city_id = sp.getCityId();
        model.local = sp.getLocal();
        model.coin_name = sp.getCoin_name();
        model.coin_url = sp.getCoin_url();
        model.boot_img = sp.getBootImg();
        model.boot_link = sp.getBootLink();
        model.nick_name = sp.getNICK_NAME();
        model.circle_url = sp.getCircleUrl();
        return model;
    }

    /**
     * 验证是否需要登录
     */
    public boolean isNeed_login() {
        return StringUtils.isEmpty(sp.getAccessToken());
    }

    public void clear() {
        this.access_token = "";
        this.uid = "";
        sp.setUID("");
        sp.setAccessToken("");
    }

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
        sp.setAccessToken(access_token);
    }


    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
        sp.setUID(uid);
    }

    public long getAPKID() {
        return apkid;
    }

    public void setAPKID(long apkid) {
        this.apkid = apkid;
        sp.setAPKID(apkid);
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
        sp.setCITY(city);
    }

    public String getCity_id() {
        return city_id;
    }

    public void setCity_id(String city_id) {
        this.city_id = city_id;
        sp.setCITYID(city_id);
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
        sp.setLOCAL(local);
    }

    public String getCoin_name() {
        return coin_name;
    }

    public void setCoin_name(String coin_name) {
        this.coin_name = coin_name;
        sp.setCoin_name(coin_name);
    }

    public String getCoin_url() {
        return coin_url;
    }

    public void setCoin_url(String coin_url) {
        this.coin_url = coin_url;
        sp.setCoinUrl(coin_url);
    }

    public String getSugar_name() {
        return sugar_name;
    }

    public void setSugar_name(String sugar_name) {
        this.sugar_name = sugar_name;
        sp.setSugarName(sugar_name);
    }

    public String getSugar_url() {
        return sugar_url;
    }

    public void setSugar_url(String sugar_url) {
        this.sugar_url = sugar_url;
        sp.setSugarUrl(sugar_url);
    }

    public String getBoot_img() {
        return boot_img;
    }

    public void setBoot_img(String boot_img) {
        this.boot_img = boot_img;
        sp.setBootImg(boot_img);
    }

    public String getBoot_link() {
        return boot_link;
    }

    public void setBoot_link(String boot_link) {
        this.boot_link = boot_link;
        sp.setBootLink(boot_link);
    }

    public String getNick_name() {
        return nick_name;
    }

    public void setNick_name(String nick_name) {
        this.nick_name = nick_name;
        sp.setNICK_NAME(nick_name);
    }

    public String getSystem_title() {
        return system_title;
    }

    public void setSystem_title(String system_title) {
        this.system_title = system_title;
        sp.setSystemTitle(system_title);
    }

    public String getFirst_level_team() {
        return first_level_team;
    }

    public void setFirst_level_team(String first_level_team) {
        this.first_level_team = first_level_team;
        sp.setFirstLevelTeam(first_level_team);
    }

    public String getSecond_level_team() {
        return second_level_team;
    }

    public void setSecond_level_team(String second_level_team) {
        this.second_level_team = second_level_team;
        sp.setSecondLevelTeam(second_level_team);
    }

    public String getAgreement_url() {
        return agreement_url;
    }

    public void setAgreement_url(String agreement_url) {
        this.agreement_url = agreement_url;
        sp.setAgreementUrl(agreement_url);
    }

    public String getTarget_num() {
        return target_num;
    }

    public void setTarget_num(String target_num) {
        this.target_num = target_num;
        sp.setTagetNum(target_num);
    }

    public String getMenu_1() {
        return menu_1;
    }

    public void setMenu_1(String menu_1) {
        this.menu_1 = menu_1;
        sp.setMenu1(menu_1);
    }

    public String getMenu_2() {
        return menu_2;
    }

    public void setMenu_2(String menu_2) {
        this.menu_2 = menu_2;
        sp.setMenu2(menu_2);
    }

    public String getMenu_3() {
        return menu_3;
    }

    public void setMenu_3(String menu_3) {
        this.menu_3 = menu_3;
        sp.setMenu3(menu_3);
    }

    public String getMenu_4() {
        return menu_4;
    }

    public void setMenu_4(String menu_4) {
        this.menu_4 = menu_4;
        sp.setMenu4(menu_4);
    }

    public String getMenu_5() {
        return menu_5;
    }

    public void setMenu_5(String menu_5) {
        this.menu_5 = menu_5;
        sp.setMenu5(menu_5);
    }

    public String getLoading_title() {
        return loading_title;
    }

    public void setLoading_title(String loading_title) {
        this.loading_title = loading_title;
        sp.setLoadingTitle(loading_title);
    }

    public String getCircle_url() {
        return circle_url;
    }

    public void setCircle_url(String circle_url) {
        this.circle_url = circle_url;
        sp.setCircleUrl(circle_url);
    }
}
